package cn.pconline.autoclub.entity;

import java.util.Date;
import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;
import org.gelivable.dao.Transient;

@Entity(tableName = "ac_member_week")
public class MemberWeek implements EntityWithUserProp {

    @Id
    @Column(name = "club_id")
    private long clubId;			//车友会id
    @Id
    @Column(name = "user_id")
    private long userId;			//成员id
    @Column(name = "check_count")
    private int checkCount;			//周签到天数
    @Column(name = "topic_count")
    private int topicCount;			//周主题数
    @Column(name = "pick_count")
    private int pickCount;			//周精华数
    @Column(name = "recommend_count")
    private int recommendCount;		//周推荐数
    private int petrol;				//周油值
    private int rank;				//上周排名
    @Column(name = "create_at")
    private Date createAt;
    @Column(name = "update_at")
    private Date updateAt;
    @Column(name = "rank_yesterday")
    private int rankYesterday;//昨天排名
    @Column(name = "rank_yesterday_before")
    private int rankYesterdayBefore;//前天排名
    @Column(name = "petrol_yesterday")
    private int petrolYesterday;//昨天周油值
    @Transient
    private ClubMember clubMember;
    @Transient(cache = false)
    private User user;
    @Transient
    private int rankUpDown;//昨天-前天排名得到的值

    public long getClubId() {
        return clubId;
    }

    public void setClubId(long clubId) {
        this.clubId = clubId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public int getCheckCount() {
        return checkCount;
    }

    public void setCheckCount(int checkCount) {
        this.checkCount = checkCount;
    }

    public int getTopicCount() {
        return topicCount;
    }

    public void setTopicCount(int topicCount) {
        this.topicCount = topicCount;
    }

    public int getPickCount() {
        return pickCount;
    }

    public void setPickCount(int pickCount) {
        this.pickCount = pickCount;
    }

    public int getRecommendCount() {
        return recommendCount;
    }

    public void setRecommendCount(int recommendCount) {
        this.recommendCount = recommendCount;
    }

    public int getPetrol() {
        return petrol;
    }

    public void setPetrol(int petrol) {
        this.petrol = petrol;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public Date getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Date createAt) {
        this.createAt = createAt;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }

    public ClubMember getClubMember() {
        return clubMember;
    }

    public void setClubMember(ClubMember clubMember) {
        this.clubMember = clubMember;
    }

    public int getRankYesterday() {
        return rankYesterday;
    }

    public void setRankYesterday(int rankYesterday) {
        this.rankYesterday = rankYesterday;
    }

    public int getRankYesterdayBefore() {
        return rankYesterdayBefore;
    }

    public void setRankYesterdayBefore(int rankYesterdayBefore) {
        this.rankYesterdayBefore = rankYesterdayBefore;
    }

    public int getRankUpDown() {
        return rankUpDown;
    }

    public void setRankUpDown(int rankUpDown) {
        this.rankUpDown = rankUpDown;
    }

    public int getPetrolYesterday() {
        return petrolYesterday;
    }

    public void setPetrolYesterday(int petrolYesterday) {
        this.petrolYesterday = petrolYesterday;
    }

    @Override
    public long getUid() {
        return userId;
    }

    @Override
    public User getUser() {
        return user;
    }

    @Override
    public void setUid(long uid) {
        this.userId = uid;

    }

    @Override
    public void setUser(User user) {
        this.user = user;

    }

    public static MemberWeek getInstance(long clubId, long userId, Date now) {
        MemberWeek m = new MemberWeek();
        m.setCheckCount(0);
        m.setTopicCount(0);
        m.setPickCount(0);
        m.setRecommendCount(0);
        m.setPetrol(0);
        m.setRank(0);
        m.setClubId(clubId);
        m.setUserId(userId);
        m.setCreateAt(now);
        m.setUpdateAt(now);
        m.setRankYesterday(0);
        m.setRankYesterdayBefore(0);
        return m;
    }
}
